import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';

export const columns: BasicColumn[] = [
   {
    title: '轮播图标题',
    dataIndex: 'bannerTitle'
   },
  {
    title: '轮播图图片',
    dataIndex: 'bannerImageList',
    slots: { customRender: 'img' },
  },
   {
    title: '启用状态',
    dataIndex: 'bannerStatus_dictText'
   },
   {
    title: '跳转路径',
    dataIndex: 'bannerUrl'
   },
];

export const searchFormSchema: FormSchema[] = [
 {
    label: '轮播图标题',
    field: 'bannerImage',
    component: 'Input'
  },
];

export const formSchema: FormSchema[] = [
  // TODO 主键隐藏字段，目前写死为ID
  {label: '', field: 'bannerId', component: 'Input', show: false},
  {
    label: '轮播图标题',
    field: 'bannerTitle',
    component: 'Input',
  },
  {
    field: 'bannerImage',
    component: 'JImageUpload',
    label: '轮播图图片',
    helpMessage: '最多上传1张图片',
    componentProps: {
      listType : 'picture',
      fileMax : 1,
    }
  },
  {
    field: 'bannerStatus',
    component: 'JDictSelectTag',
    label: '启用状态',
    componentProps: {
      dictCode: 'yn3',
      stringToNumber: true,
      type: 'radioButton',
    },
    defaultValue: 1,
  },
  {
    label: '跳转路径',
    field: 'bannerUrl',
    component: 'Input',
  },
];
